package test.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;
import org.springframework.core.annotation.Order;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.builders.WebSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;

import javax.annotation.PostConstruct;

/**
 * Created by 张少昆 on 2017/12/23.
 */
@Configuration
// @EnableWebSecurity
@ImportResource( "classpath:spring-security.xml" )
// @Order( 2147483640 )
public class SecurityConfig /*extends WebSecurityConfigurerAdapter*/ {
    @PostConstruct
    public void init(){
        System.out.println("test.config.SecurityConfig inited!");
    }

    // @Override
    // protected void configure(HttpSecurity http) throws Exception {
    //     http.authorizeRequests().antMatchers("/**").hasRole("USER").and().formLogin();
    // }
    //
    // @Override
    // protected void configure(AuthenticationManagerBuilder auth) throws Exception {
    //     auth.inMemoryAuthentication().withUser("user").password("password").roles("USER");
    // }
    //
    // @Override
    // public void configure(WebSecurity web) throws Exception{
    //     web.ignoring().antMatchers("/**/*.js", "/**/*.js.map", "/**/*.ts", "/**/*.css", "/**/*.css.map", "/**/*.png", "/**/*.gif", "/**/*.jpg", "/**/*.fco", "/**/*.woff", "/**/*.woff2", "/**/*.font", "/**/*.svg", "/**/*.ttf", "/**/*.pdf", "/*.ico", "/admin/api/**", "/404", "/401", "/403", "/error");
    // }

}
